import trigger from "../../effect/trigger.js";
import { TriggerOpTypes } from "../../util.js";

export default function (target, key) {
  // 判断下目标是否有该属性
  const hasKey = target.hasOwnProperty(key);
  // 进行删除
  const result = Reflect.deleteProperty(target, key);
  console.log(result);
  if (hasKey && result) {
    trigger(target, TriggerOpTypes.DELETE, key);
  }
  return result;
}
